{% extends "student/base.html" %}
{% import 'student/assignment/_tablehelper.html' as table with context %}

{% set name = 'Submissions' if submit else 'Backups' %}

{% block title %} {{ assignment.display_name }} | Ok {% endblock %}

{% block body %}
    <main>
      {% include 'student/assignment/sidebar.html' %}
      <div class="col-md-2"></div>
      <section class="content nomapa col-md-10 col-xs-12">
        {% include 'student/header.html' %}

        <div class="subcontent heading">
          <div class="wrap">
            <div class="string-nav" role="navigation" aria-label="page navigation">
              <span><a href="{{ url_for('.index') }}">Courses</a></span> &raquo;
              <span><a href="{{ url_for('.course', offering=course.offering) }}"> {{ course.display_name_with_semester }}</a></span> &raquo;
              <span><a href="{{ url_for('.assignment', name=assignment.name) }}"> {{ assignment.display_name }}</a></span> &raquo;
              {{ name }}
            </div>
            <h1>
              {{ paginate.total }} {{ name }}
            </h1>
          </div>

          {% include 'alerts.html' %}

        </div>

        <div class="subcontent">
            {% if submit %}
              {{ table.render_subms(paginate.items, course, flagged, csrf_form, tname="Submissions") }}
              {{ table.render_subms_mobile(paginate.items, course, flagged, csrf_form, tname="Submissions") }}
            {% else %}
              {{ table.render_backups(paginate.items, course, flagged, csrf_form, tname="Backups") }}
              {{ table.render_backups_mobile(paginate.items, course, flagged, csrf_form, tname="Backups") }}
            {% endif %}

            <ul class="pager">
              {% if paginate.has_prev %}
                <li><a href="{{ url_for('.list_backups', name=assignment.name, page=paginate.prev_num, submit=submit)}}"><span aria-hidden="true">&larr;</span>Page {{ paginate.prev_num }}</a></li>
              {% else %}
                <li class="disabled"><a href="#"><span aria-hidden="true">&larr;</span>Previous</a></li>
              {% endif %}
              {% if paginate.has_next %}
                <li><a href="{{ url_for('.list_backups', name=assignment.name, page=paginate.next_num, submit=submit)}}"><span aria-hidden="true">&rarr;</span> Page {{ paginate.next_num }}</a></li>
              {% else %}
                <li class="disabled"><a href="#"><span aria-hidden="true">&rarr;</span> Next </a></li>
              {% endif %}
          </div>

        </div>


      </section>

    </main>
{% endblock %}
